package vin.pth.authorization.handler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import vin.pth.authorization.exception.AuthorizationException;
import vin.pth.base.pojo.Authentication;

/**
 * 认证处理器.
 *
 * @author Cocoon
 */
public interface AuthorizationHandler {

  /**
   * 登录失败的处理行为.
   *
   * @param request  HttpServletRequest
   * @param response HttpServletResponse
   * @param e        认证失败的异常
   */
  void failureHandler(HttpServletRequest request, HttpServletResponse response,
      AuthorizationException e);

  /**
   * 认证通过的处理行为.
   *
   * @param request      HttpServletRequest
   * @param response     HttpServletResponse
   * @param authenticate 认证信息
   */
  void successHandle(HttpServletRequest request, HttpServletResponse response,
      Authentication authenticate);

}
